<include file="Public:head" />
<include file="Public:header" />
<include file="Public:left" />
<section id='content'>
    <div class='container-fluid'>
        <div class='row-fluid' id='content-wrapper'>
            <div class='span12'>
                <div class='row-fluid'>
                    <div class='span12'>
                        <div class='page-header'>
                            <h1 class='pull-left'>
                                <i class='icon-ok'></i>
                                <span>添加企业</span>
                            </h1>
                        </div>
                    </div>
                </div>
                <div class='row-fluid'>
                    <div class='span12 box'>
                        <div class='box-header blue-background'>
                            <div class='title'>添加企业</div>
                        </div>
                        <div class='box-content'>
                            <form class='form form-horizontal validate-form' style='margin-bottom: 0;' action="{:U('Company/company_doadd')}" method="post"/>
                                <div class='control-group'>
                                    <label class='control-label' for='company_agent'>经销商</label>
                                    <div class='controls'>
                                        <select data-rule-required='true' id='company_agent' name='company_agent'>
											<volist name="agent" id="a">
                                            <option value="{$a.aid}"/>{$a.uname}
											</volist>
                                        </select>
                                    </div>
                                </div>
								
                                <div class='control-group'>
                                    <label class='control-label' for='company_name'>企业名称</label>
                                    <div class='controls'>
                                        <input data-rule-minlength='2' data-rule-required='true' id='company_name' name='company_name' placeholder='企业名称' type='text' />
                                    </div>
                                </div>
								
                                <div class='control-group'>
                                    <label class='control-label' for='company_admin'>企业账号</label>
                                    <div class='controls'>
                                        <input data-rule-minlength='2' data-rule-required='true' id='company_admin' name='company_admin' placeholder='企业账号' type='text' />
                                    </div>
                                </div>
                                
                                <div class='control-group'>
                                    <label class='control-label' for='company_pwd'>企业密码</label>
                                    <div class='controls'>
                                        <input data-rule-minlength='6' data-rule-password='true' data-rule-required='true' id='company_pwd' name='company_pwd' placeholder='企业密码' type='password' />
                                    </div>
                                </div>
                                <div class='control-group'>
                                    <label class='control-label' for='company_area'>所在城市</label>
                                    <div class='controls'>
                                        <select name="pro" class="s-text-select pro">
											<option value="0" selected>省</option>
											<volist name="pro" id="p">
											<option  value="{$p.area_id}">{$p.title}</option>
											</volist>
										</select>
										<select name="city" class="s-text-select city">
											<option value="0" selected>市</option>
										</select>
										<select name="area" class="s-text-select area">
											<option value="0" selected>区</option>
										</select>
                                    </div>
                                </div>
                                
                                <div class='control-group'>
                                    <label class='control-label' for='company_menu'>套餐类型</label>
                                    <div class='controls'>
                                        <select data-rule-required='true' id='company_menu' name='company_menu'>
											<volist name="menu" id="m">
                                            <option value="{$m.mid}"/>{$m.m_name}（{$m.time}）
											</volist>
                                        </select>
                                    </div>
                                </div>
                                <div class='form-actions' style='margin-bottom:0'>
                                    <button class='btn btn-primary' type='submit'>
                                        <i class='icon-save'></i>
                                        添加企业
                                    </button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                
            </div>
        </div>
    </div>
</section>
</div>
<include file="Public:bottom" />
<script type="text/javascript">
    $(document).ready(function () {
		$("ul[class='nav nav-stacked']").removeClass('in');
		$("#company").addClass('in');
		$("li[class='guan']").removeClass('active');
		$("#company_add").addClass('active');
		$(".pro").change(function(){
			pro = $(this).val();
			$.post("__URL__/getarea",{type:'city',aid:pro},function(res){
				$(".city option").remove();
				$(".city").append("<option value='0'>市</option>");
				for(i=0;i<res.length;i++){
					$(".city").append("<option value='"+res[i]['area_id']+"'>"+res[i]['title']+"</option>");
				}
			},'json');
		});
		$(".city").change(function(){
			city = $(this).val();
			$.post("__URL__/getarea",{type:'area',aid:city},function(res){
				$(".area option").remove();
				$(".area").append("<option value='0'>区</option>");
				for(i=0;i<res.length;i++){
					$(".area").append("<option value='"+res[i]['area_id']+"'>"+res[i]['title']+"</option>");
				}
				//alert(res);
			},'json');
		});
    });
</script>